import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '@/views/HomeView.vue';
import QueryView from '@/views/QueryView.vue';
import ManageView from '@/views/ManageView.vue';
import CreateCarView from '@/views/CreateCarView.vue';
import EditCarView from '@/views/EditCarView.vue';
import CarDetailView from '@/views/CarDetailView.vue';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: HomeView
  },
  {
    path: '/query',
    name: 'Query',
    component: QueryView
  },
  {
    path: '/manage',
    name: 'Manage',
    component: ManageView
  },
  {
    path: '/cars/create',
    name: 'CreateCar',
    component: CreateCarView
  },
  {
    path: '/cars/edit/:brandName/:configName',
    name: 'EditCar',
    component: EditCarView,
    props: true
  },
  {
    path: '/cars/detail/:brandName/:configName',
    name: 'CarDetail',
    component: CarDetailView,
    props: true
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;